We don't want to select on focus-in when the focus
comes from a child. The case where this does harm
is when you activate copy or paste actions from the
context menu. We close the menu before triggering the
action, and if that causes the text in the entry to
be selected, unexpected things happen, since the action
applies to the current selection.
Fixes: #2869
GtkText *self = GTK_TEXT (widget);
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
gboolean select_on_focus;
+ GtkWidget *prev_focus;
+
+ prev_focus = gtk_root_get_focus (gtk_widget_get_root (widget));
if (!GTK_WIDGET_CLASS (gtk_text_parent_class)->grab_focus (GTK_WIDGET (self)))
return FALSE;
- if (priv->editable && !priv->in_click)
+ if (priv->editable && !priv->in_click &&
+ !(prev_focus && gtk_widget_is_ancestor (prev_focus, widget)))
{
g_object_get (gtk_widget_get_settings (widget),
"gtk-entry-select-on-focus",